package com.yunji.storage.service.impl;

import com.yunji.storage.bo.DiscardInfoListQueryBO;
import com.yunji.storage.dao.IDiscardInfoDao;
import com.yunji.storage.domain.DiscardInfoDO;
import com.yunji.storage.mapper.DiscardInfoMapper;
import com.yunji.storage.service.IDiscardInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.storage.service.impl
 * @Title: DiscardInfoServiceImpl
 * <p>
 * History:
 * Date                     Version     Author          Summary
 * ============================================================
 * 2024-08-24 14:36:55      V1.0        HuaAo       新建类
 */
@Service
public class DiscardInfoServiceImpl implements IDiscardInfoService {

    @Resource
    DiscardInfoMapper discardInfoMapper;

    @Resource
    IDiscardInfoDao discardInfoDao;

    @Override
    public List<DiscardInfoDO> search(DiscardInfoListQueryBO bo) {
        return discardInfoDao.search(bo);
    }

    @Override
    public boolean deleteByInfoIds(List<Long> infoIds) {
        if (infoIds.isEmpty()) {
            return true;
        } else {
            return discardInfoDao.removeByIds(infoIds);
        }
    }

    @Override
    public boolean create(DiscardInfoDO discardInfo) {
        return discardInfoDao.save(discardInfo);
    }

    @Override
    public boolean update(DiscardInfoDO discardInfo) {
        return discardInfoDao.updateById(discardInfo);
    }

    @Override
    public boolean deleteByDiscardIds(Long... discardIds) {
        return discardInfoDao.deleteByDiscardIds(discardIds);
    }
}